﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace ChartFromClass
{
    public partial class Form1 : Form
    {
        public app cht;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            cht = new app(this);
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cht.AddRest();
        }
    }

    public class app
    {
        private Form _form;
        private Chart _chart;
        
        public app(Form frm)
        {
            _form = frm;
            _chart = new Chart();
            _chart.Width = _form.Width;
            _chart.Height = _form.Height;
            _form.Controls.Add(_chart);
        }
        public void AddRest()
        {
            ChartArea area = new ChartArea();
            _chart.ChartAreas.Add(area);
            Series s1 = new Series();

            s1.Points.Add(34);

            _chart.Series.Add(s1);
            
            

        }
    }
}
